package com.webserver.core;

import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;

/**
 *  用于处理客户端的交互
 */
public class ClientHandler implements Runnable{
    private Socket socket;
    public ClientHandler(Socket socket){
        this.socket = socket;
    }

    public void run(){
        try {
            InputStream in = socket.getInputStream();
            int d;
            while ((d = in.read()) != -1){
                char c = (char)d;
                System.out.print(c);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
